package com.example.javaee.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.javaee.domain.Course;
import com.example.javaee.domain.UserCourse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserCourseMapper extends BaseMapper<UserCourse>
{
    @Select("select * from user_course where userId=#{userId} and courseId=#{courseId}")
    List<UserCourse> findByIdAndTeacherName(Long userId, Long courseId);

    @Select("select * from course left join user_course on course.id=user_course.courseId where user_course.userId=#{userId}")
    List<Course> getCoursesByUserId(Long userId);
}
